package com.wxzz.elearing.comment.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wxzz.elearing.comment.dto.AdminQueAnsEnterpriseDto;
import com.wxzz.elearing.comment.dto.ArticleStatusDto;
import com.wxzz.elearing.comment.entity.EnterpriseQuesAns;
import com.wxzz.elearing.comment.entity.QueAnsAcceptInfo;
import com.wxzz.elearing.comment.entity.QuestionsAnswersList;
import com.wxzz.elearing.comment.mapper.AdminEnterpriseQuesAnsMapper;
import com.wxzz.elearing.comment.mapper.CommunityQuestionsAnswersListMapper;
import com.wxzz.elearing.comment.mapper.QueAnsAcceptInfoMapper;
import com.wxzz.elearing.comment.mapper.QuestionsAnswersListMapper;
import com.wxzz.elearing.comment.service.ICommunityEnterpriseQuesAnsService;
import com.wxzz.elearing.comment.service.IEnterpriseQuesAnsService;
import com.wxzz.elearing.comment.service.openfeign.IEnterQueAnsApiFeign;
import com.wxzz.elearing.comment.vo.CommunityUserInfoVo;
import com.wxzz.elearing.comment.vo.EnterpriseQueAnsVo;
import com.wxzz.elearing.comment.vo.QueAnsUserInfoVo;
import com.wxzz.elearning.common.dto.FeignWxUserDto;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2021-05-18
 */
@Service
public class CommunityEnterpriseQuesAnsServiceImpl extends ServiceImpl<AdminEnterpriseQuesAnsMapper, EnterpriseQuesAns> implements ICommunityEnterpriseQuesAnsService {

    @Autowired
    private IEnterQueAnsApiFeign iEnterQueAnsApiFeign;


    @Resource
    private CommunityQuestionsAnswersListMapper communityQuestionsAnswersListMapper;


    public ReturnVO<FeignWxUserDto> getUserInfo(Long userId){
        FeignWxUserDto model= iEnterQueAnsApiFeign.selectFeignWxUserDtoByWxUserId(userId);
        return new ReturnVO("查询成功",model);
    }

    public ReturnVO changeAricleStatus(ArticleStatusDto articleStatusDto){
        communityQuestionsAnswersListMapper.updateStatus(articleStatusDto);
        if(articleStatusDto.getStatus()==1){
            return new ReturnVO("文章上架成功",1);
        }
        return new ReturnVO("文章下架成功",1);
    }
}
